package com.jiangyg.mall.admin.controller;

import com.jiangyg.mall.admin.vo.OauthClientVO;
import com.jiangyg.mall.admin.service.OauthClientService;
import com.jiangyg.mall.core.support.restful.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 类描述：Oauth2客户端信息
 *
 * @author jiangyg
 * @date 2022-01-07
 */
@RestController
@RequestMapping("/oclient")
public class OauthClientController {

    private final OauthClientService oauthClientService;

    @Autowired
    public OauthClientController(OauthClientService oauthClientService) {
        this.oauthClientService = oauthClientService;
    }

    /**
     * 功能描述：根据ID获取客户端信息
     *
     * @param cilentId 客户端ID
     * @return 结果
     * @throws Exception 异常
     */
    @ResponseBody
    @PostMapping("/info")
    public Result<OauthClientVO> info(@RequestParam(name = "cilentId") String cilentId) throws Exception {
        return Result.ok(oauthClientService.selectById(cilentId));
    }

}
